<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>


<script type="text/javascript" src="js/jquery.itextclear.js"></script>
<script type="text/javascript" src="${ctx}/js/cookie.js"></script>
<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$(
								'input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea',
								'.form').iTextClear();
					});
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="${ctx}/css/Tree.css" />
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />
<script type="text/javascript"
	src="lib/datatables/js/jquery.dataTables.js"></script>
<!-- DATATABLES CSS END -->

<h1 class="page-title">${listTitle}</h1>

<div class="container_12 clearfix leading">

	<%@ include file="/WEB-INF/pages/common/common_tree.jsp"%>

	<section id="list_content" class="clearfix"></section>
</div>

<div class="clear"></div>
<div class="container_12 clearfix leading">
	<section class="portlet grid_12 leading">
		<header>
			<h2>已选择</h2>
		</header>
		<section id="duty_has_sel_section">
			<%-- <a class="button" href="javascript:void(0)"><span
							style="background: url(images/img/add.png)" class="icon">&nbsp;</span>高级主管：5分</a>
							
							<s:iterator var="target" value="#request.dutyTargets">
				<a class="button" href="javascript:void(0)"><span
							style="background: url(images/img/add.png)" class="icon">&nbsp;</span>${target.duty.dutyName}：${target.credit}分</a>
			</s:iterator>
						 --%>
		</section>

	</section>
</div>
<div class="container_12 clearfix leading" style="padding-left: 20px">
	<div class="form-action clearfix">
		<p>
			<a class="button" href="javascript:void(0)"
				onclick="dispatchCookies()"><span
				style="background: url(${ctx}/images/img/page_edit.png)"
				class="icon">&nbsp;</span>全部提交</a> <a class="button"
				href="javascript:void(0)" onclick="javascript:history.back()"><span
				style="background: url(${ctx}/images/img/arrow_undo.png)"
				class="icon">&nbsp;</span>返回</a>
		</p>
	</div>

</div>
<script type="text/javascript" src="${ctx}/js/Tree.js"></script>

<script type="text/javascript">
	$(document).ready(function(){
		asyncUpdateSelectBody();
	});
	
	function asyncUpdateSelectBody(){
		$("#duty_has_sel_section").html("");
		var url = "${ctx}/ajax/train_dutytargets.xhtml";
        $.getJSON(url,function (targets) {
            	if(targets != null && targets.length > 0){
            		var strHTML = "";
            		 $.each(targets, function(i, target) {
            			 strHTML += "<a class=\"button\" href=\"javascript:void(0)\"><span style=\"background: url(images/img/add.png)\" class=\"icon\">&nbsp;</span>" + target.dutyName + "：" + target.credit + "分</a>";
                     });
            		$("#duty_has_sel_section").html(strHTML);
            	}else{
            		$("#duty_has_sel_section").html("暂无选择任何对象");
            	}
        });
	}
	// 提交计划目标选择 
	function dispatchCookies() {
		//window.history.back();
		
		/*if(getCookie("dutytarget") != null){
            var url = "${ctx}/ajax/train-plan-dutytarget-save.xhtml";
            $.ajax(url, {
                type:"POST",
                data:{"dutytarget":getCookie("dutytarget")},
                dataType:"html",
                cache:false,
                success:function (a) {
                	window.location.href = "${ctx}/index.xhtml#train/plan_manage.xhtml?organizationId=${organizationId}&planId=${planId}";
                },
                complete:function () {
                	window.location.href = "${ctx}/index.xhtml#train/plan_manage.xhtml?organizationId=${organizationId}&planId=${planId}";
                }
            });
        }else{*/
			window.location.href = "${ctx}/index.xhtml#train/plan_manage.xhtml?organizationId=${organizationId}&planId=${planId}";
        //} 
   }

	
</script>